import type { PropType } from "vue";

export declare type MentionOption = {
  value: string;
  label?: string;
  parent?: string;
  disabled?: boolean;
  icon?: string;
  [key: string]: any;
};

export const definePropType = <T>(val: any): PropType<T> => val;

export interface MentionCtx {
  pattern: string;
  start: number;
  end: number;
  prefix: string;
  prefixIndex: number;
  splitIndex: number;
  selectionEnd: number;
}

export const EVENT_CODE = {
  tab: "Tab",
  enter: "Enter",
  space: "Space",
  left: "ArrowLeft", // 37
  up: "ArrowUp", // 38
  right: "ArrowRight", // 39
  down: "ArrowDown", // 40
  esc: "Escape",
  delete: "Delete",
  backspace: "Backspace",
  numpadEnter: "NumpadEnter",
  pageUp: "PageUp",
  pageDown: "PageDown",
  home: "Home",
  end: "End",
};
